//
//  C_MusicCircelCollectionViewCell.m
//  音悦咖
//
//  Created by Best on 15/7/14.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "C_MusicCircelCollectionViewCell.h"

@implementation C_MusicCircelCollectionViewCell

- (void)dealloc
{
    [_imageView release];
    [_labelView release];
    [_model release];
    [super dealloc];
}

-(instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self create];
    }
    
    return self;
}


- (void)create
{
    self.imageView = [[UIImageView alloc] init];
    [self addSubview:self.imageView];
    [_imageView release];
    
    self.labelView = [[UILabel alloc] init];
    [self.labelView setTextColor:[UIColor whiteColor]];
    [self.imageView addSubview:self.labelView];
    [_labelView release];
  
}

- (void)applyLayoutAttributes:(UICollectionViewLayoutAttributes *)layoutAttributes
{
    
    self.imageView.frame = layoutAttributes.bounds;
    CGFloat width = self.imageView.frame.size.width;
    CGFloat height = self.imageView.frame.size.height;
    self.labelView.frame = CGRectMake(5, height - 40, width, 30);
}


- (void)setModel:(MusicModel *)model
{
    if (_model != model) {
        [_model release];
        _model = [model retain];
    }
    
    self.imageView.image = [UIImage imageNamed:model.imageName];
    self.labelView.text = model.title;
    
    
    
}

@end
